package com.example.springboot_mongo.entity;

import com.example.springboot_mongo.util.TableUtil;
import org.springframework.data.mongodb.core.mapping.Document;

import java.util.Date;

@Document
public class User {

	private String id;
	private String username;
	private int age;
	private Date createTime;

	/**
	 * 几点 12小时制 按小时分表更加均匀
	 */
	private int hour=TableUtil.getHourFor12();

	public int getHour() {
		return hour;
	}

	/**
	 * 月份 根据月份区分表 必须传
	 */
	private int month= TableUtil.month;

	public int getMonth() {
		return month;
	}

	public User() {

	}

	public User(String username, int age, Date createTime) {
		super();
		this.username = username;
		this.age = age;
		this.createTime = createTime;
	}

	public String getId() {
		return id;
	}

	public void setId(String id) {
		this.id = id;
	}

	public String getUsername() {
		return username;
	}

	public void setUsername(String username) {
		this.username = username;
	}

	public int getAge() {
		return age;
	}

	public void setAge(int age) {
		this.age = age;
	}

	public Date getCreateTime() {
		return createTime;
	}

	public void setCreateTime(Date createTime) {
		this.createTime = createTime;
	}


	@Override
	public String toString() {
		return "User{" +
				"id='" + id + '\'' +
				", username='" + username + '\'' +
				", age=" + age +
				", createTime=" + createTime +
				'}';
	}
}
